

package com.soso.base.google.mq;

import java.util.HashMap;
import java.util.Map;


/**
 * 
 * @author speed
 *
 */
@SuppressWarnings("serial")
public class SimpleMessage extends AbstractMessage {

	private Map<String,String> message;
	public SimpleMessage(Class<?> clazz) {
		this("simple.command", null);
		setCommandClassName(clazz.getName());
	}
	public SimpleMessage(String topic, Map<String,String> msg) {
		super();
		setTopic(topic);
		message = msg;
	}
	public SimpleMessage(Enum<?> topic, Map<String,String> msg) {
		this(topic.name(), msg);
	}
	public SimpleMessage(Enum<?> topic, QueueName queueName, Map<String,String> msg) {
		this(topic, msg);
		setQueueName(queueName);
	}
	public SimpleMessage(Enum<?> topic, QueueName queueName, Enum<?> method , Map<String,String> msg) {
		this(topic, queueName, msg);
		if(method!=null){
			setMethod(method.name());
		}
	}
	public SimpleMessage(Enum<?> topic, QueueName queueName, Enum<?> method, Map<String,String> msg, Map<String, String> headers) {
		this(topic, queueName, method, msg);
		setHeaders(headers);
	}

	public SimpleMessage(Enum<?> topic) {
		this(topic.name(), null);
	}

	public Map<String,String> getMessage() {
		return message;
	}
	public void addMessage(String name,String value){
		if(message==null){
			message=new HashMap<String,String>();
		}
		message.put(name, value);
	}

}
